<?php
require_once './aliyun-openapi-php-sdk-master/aliyun-php-sdk-core/Config.php'; // �ٶ�����Դ���ļ���aliyun-php-sdk����ͬһĿ¼
use vod\Request\V20170321 as vod;
function initVodClient($accessKeyId, $accessKeySecret) {
	$regionId = 'cn-shanghai'; 
	$profile = DefaultProfile::getProfile ( $regionId, $accessKeyId, $accessKeySecret );
	return new DefaultAcsClient ( $profile );
}

function getPlayAuth($client, $videoId) {
	$request = new vod\GetVideoPlayAuthRequest ();
	$request->setVideoId ( $videoId );
	$request->setAuthInfoTimeout ( 3600 );
	$request->setAcceptFormat ( 'JSON' );
	$response = $client->getAcsResponse ( $request );
	return $response;
}
try {
	$accessKeyId = '<AccessKeyId>';
	$accessKeySecret = '<AccessKeySecret>';
	$VideoId = 'd4e1656d3d1442dab564904a15e44524';
	$client = initVodClient ( $AccessKeyId, $AccessKeySecret );
	$playAuth = getPlayAuth ( $client, $VideoId);
	// print($playAuth->PlayAuth."\n");
	$palyauth = $playAuth->PlayAuth;
	$palymeta = $playAuth->VideoMeta;
	// print_r($playAuth->VideoMeta);
} catch ( Exception $e ) {
	print $e->getMessage () . "\n";
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<title>Vod</title>
<link rel="stylesheet"
	href="//g.alicdn.com/de/prismplayer/2.6.0/skins/default/aliplayer-min.css" />
<script type="text/javascript"
	src="//g.alicdn.com/de/prismplayer/2.6.0/aliplayer-min.js"></script>
</head>
<body style="margin:0 auto;padding:0;">
	<div class="prism-player" id="J_prismPlayer"></div>
	<script>
                var player = new Aliplayer({
                  id: "J_prismPlayer",
                  autoplay: false,
                  preload:false,
                  width:"100%",
                  height:"30rem",
                  vid:"<?php echo $VideoId;?>",
                  playauth:'<?php echo $palyauth;?>',
                  cover:'<?php echo $palymeta->CoverURL;?>',
                  isLive:false,
                  playsinline:true,
                  showBuffer:true,
                  definition:'FD',
                });
              </script>
</body>